package waterreview.activity;

import android.os.Bundle;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;

import com.whu.zj.MyApplication;
import com.whu.zj.R;
import com.whu.zj.UIHandler;

/**
 * Created by Administrator on 2016/12/9.
 */
public class WaterReviewActivity extends UIHandler.BaseActivity{

    WebView webView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_waterreview);
        initview();
    }

    private void initview() {
        String ip = MyApplication.share().getResources().getString(R.string.basicIP);
        String url = "http://" +ip + "/Waterworks/Operation4Mobile/CopyqualityRecordData.jsp";
        webView = (WebView) findViewById(R.id.id_wbview);
        webView.loadUrl(url);

        webView.setWebViewClient(new WebViewClient() {
            public boolean shouldOverrideUrlLoading(WebView view, String url)
            {
                //  重写此方法表明点击网页里面的链接还是在当前的webview里跳转，不跳到浏览器那边
                view.loadUrl(url);
                return true;
            }
        });

        webView.getSettings().setSupportZoom(true);
        webView.getSettings().setBuiltInZoomControls(true);
        webView.getSettings().setJavaScriptEnabled(true);
        WebSettings webSettings = webView.getSettings();
        webSettings.setUseWideViewPort(true);//关键点
    }
}
